package com.example.homework4;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity2 extends AppCompatActivity {

    private TextView tv_username;
    private TextView tv_password;
    private TextView tv_cknumber;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //获取对象
        Intent intent = getIntent();

        //取出key值
        String name=intent.getStringExtra("name");
        String password=intent.getStringExtra("password");
        String cknumber=intent.getStringExtra("cknumber");

        tv_username=(TextView) findViewById(R.id.tv_username);
        tv_password=(TextView) findViewById(R.id.tv_password);
        tv_cknumber=(TextView) findViewById(R.id.tv_cknumber);

        tv_username.setText("用户名："+ name);
        tv_password.setText("密  码："+ password);
        tv_cknumber.setText("验证码："+ cknumber);


        //跳转
        Button bt_baidu = (Button) findViewById(R.id.bt_baidu);
        Button bt_BILIBILI = (Button) findViewById(R.id.bt_BILIBILI);
        Button bt_wyy = (Button) findViewById(R.id.bt_wyy);

        //百度
        bt_baidu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                //设置动作为android.intent.action.VIEW
                intent.setAction("android.intent.action.VIEW");
                //设置打开网址
                intent.setData(Uri.parse("https://www.baidu.com/"));
                startActivity(intent);
            }
        });

        //哔哩哔哩
        bt_BILIBILI.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                //设置动作为android.intent.action.VIEW
                intent.setAction("android.intent.action.VIEW");
                //设置打开网址
                intent.setData(Uri.parse("https://www.bilibili.com/"));
                startActivity(intent);
            }
        });

        //网易云
        bt_wyy.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                //设置动作为android.intent.action.VIEW
                intent.setAction("android.intent.action.VIEW");
                //设置打开网址
                intent.setData(Uri.parse("https://music.163.com/"));
                startActivity(intent);
            }
        });
    }


}